<template>
    <div>
        <p>
            <router-link to="page1">page1</router-link>
            <router-link to="page2">page2</router-link>
        </p>
        <router-view></router-view>
    </div>
</template>

<script>
import Vue from "vue";
import VueRouter from "vue-router";
import Page1 from "./Page1.vue";
import Page2 from "./Page1.vue";

const routes = [
  { path: "page1", component: Page1 },
  { path: "page2", component: Page2 }
];
const router = new VueRouter({
  routes // (缩写) 相当于 routes: routes
});
// console.log(router);
Vue.use(router);
export default {
  name: "route",
  components: {
    Page1,
    Page2
  }
};
</script>

<style>
</style>
